package com.robot.dao.mapper;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;

import com.github.pagehelper.Page;
import com.robot.dao.entity.File;
import com.robot.dao.entity.Knowledge;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;
import org.springframework.stereotype.Repository;

import java.util.List;

@Mapper
@Repository
public interface KnowledgeMapper extends BaseMapper<Knowledge> {

    List<Knowledge> queryByRobotId(Long robotId);
    Page<Knowledge> pageQuery(@Param("id") Long id, @Param("type")Integer type,@Param("knowledgeName")String knowledgeName);

    Page<File> pageQueryFile(@Param("id") Long id,@Param("fileName") String fileName);

    void create(Knowledge knowledge);

    List<Knowledge> queryByUserId(Long userId);

    List<Knowledge> queryKnowledgesByRobotId(Long robotId);

    List<Knowledge> queryDatasourcesByRobotId(Long robotId);

//    List<Knowledge> queryByRobotIdAndKnowtype(@Param("robotid") Long robotid,@Param("knowledgetype") int knowledgetype);
    List<Knowledge> queryByRobotIdAndKnowtype(Long robotId,Integer knowledgeType);

    @Select("select * from knowledge where id = #{id}")
    Knowledge queryByKnowledgeId(Long id);
}
